package TEST;

public class TestPSO2 {

	static double f(double x, double y){
		return 0.5+(Math.pow(Math.sin(Math.sqrt(Math.pow(x,2) + Math.pow(y,2))),2)-0.5)/(1+0.1*(Math.pow(x,2) + Math.pow(y,2)));
	}

	public static void main(String[] args)
	{
	    double low = -10.0, up = 10.0, min = up, step = 0.01;
	    double x, min_x = up;
	    double y, min_y = up;
	    for(x = up; x >= low; x -= step){
	    	for(y = up; y >= low; y -= step){
	            if(f(x,y) < min){
	               min_x = x;
	               min_y = y;
	               min = f(x,y);
	            }
	    	}
	    }
	    System.out.printf( "min : \n" + "x = " + min_x + " \ny = " + min_y + "\nf(x,y) = " + min );
	} 

}
